<template>
    <a-modal :title="$t('Delete') + ' OAuth2 ' + $t('服务端')" v-model='isShow' @cancel='handleClose' width='30%'
        @ok='handleCreate' :cancelText="$t('Cancel')" :okText="$t('Sure')" :maskClosable='false' v-dragModal>
        <a-spin :spinning="loading">
            <div class="ml-30">
                <span>{{ $t('Sure') }} {{ $t('Delete') }}【{{ formData.auth_name }}】OAuth2 {{ $t('服务端') }}{{ $t('吗？') }}</span>
            </div>
        </a-spin>
    </a-modal>
</template>

<script>
import request from '@/request/request'

export default {
    data() {
        return {
            isShow: false,
            formData: {},
            loading: false
        };
    },
    methods: {
        async handleCreate() {
            this.loading = true
            const auth_section_key = this.formData.auth_section_key
            const { data } = await request('DELETE', `/usermanager/auth_edit/?auth_section_key=${auth_section_key}`)
            this.model(data.id) //返回模板
            this.notice(data.id, data.params, data.flag) //通知列表显示
            if (data.flag === 0) {
                this.handleClose()
                // this.$message.success(msg);
                this.$emit('get-list');
            } 
            // else {
            //     this.$message.error(msg);
            // }
            this.loading = false
        },
        handleClose() {
            this.isShow = false
        }
    }

}
</script>